/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#include "stdafx.h"
#include "Chrono几何.h"

#include <ppl.h>



S_Chrono长方体几何体::S_Chrono长方体几何体(const vec3& ckg, float32 密度) {
	m_物理引擎枚举 = E_物理引擎::E_物理引擎_Chrono;
	m_Type = E_物理碰撞几何类型::E_碰撞几何_方体;
	

	m_长宽高 = vec_abs(ckg);
	m_密度 = 密度;
}

S_Chrono凸壳几何体::S_Chrono凸壳几何体(const S_三角Mesh& v, float32 密度) {
	m_Type = E_物理碰撞几何类型::E_碰撞几何_凸壳;
	m_物理引擎枚举 = E_物理引擎::E_物理引擎_Chrono;

	m_密度 = 密度;

	uint32 num = v.m_vNum;
	m_Points.resize(num);
	auto* r = m_Points.data();
	auto* p = v.m_vert;
	Concurrency::parallel_for<uint32>(0, num, [&](uint32 i) {
		r[i].x() = p[i].x;
		r[i].y() = p[i].y;
		r[i].z() = p[i].z;
	});
	
}






